---
title: Register a database connection portal
summary: Configures connection parameters and registers a named SQL Server or Oracle data portal for later retrieval.
status: draft
owner: SAIF BOF documentation team
last_reviewed: 2026-08-21
library: SAIF.Application
reference_type: embedded
operation_id: OP-APP-002
trigger: Concrete code invokes CreateSQLServerPortal(inKey) or CreateOraclePortal(inKey)
---

# Register a database connection portal

This operation configures connection parameters on `ApplicationDataAccess` and registers a named SQL Server or Oracle data portal, delegating actual portal construction to `SAIF.BOF.Framework`.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-APP-002 |
| **Trigger** | Concrete subclass code invokes `CreateSQLServerPortal(inKey)` or `CreateOraclePortal(inKey)`, typically from `OnCreateDataLayer()` |
| **Inputs** | `DBUser`, `Database`, `Server`, `BatchID` (properties), `inKey` (portal registration key) |
| **Outputs** | Registered `IDataPortalInfo`, retrievable via `DPI(inKey)` |
| **Primary components** | `ApplicationDataAccess.CreateSQLServerPortal`, `ApplicationDataAccess.CreateOraclePortal` |
| **Entry point** | `SAIF.Application\ApplicationDataAccess.vb` |

## Steps

1. Concrete code (subclass) sets `ApplicationDataAccess.DBUser`, `.Database`, `.Server`, and optionally `.BatchID` properties. No business rule is enforced at this step and no SQL/table access occurs.
2. Caller invokes `CreateSQLServerPortal(inKey)` or `CreateOraclePortal(inKey)`. The method populates an internal `clsDataAccess.clsEnvironment` (`ClientID`, `DBUser`, `Database`, `Server`, `DBMSType` = `SqlServer` or `Oracle`) — overriding `ClientID` with `BatchID` when a non-empty batch ID has been set. No business rule is enforced by this library; no SQL statement is authored here — this class only configures connection parameters, it does not execute or hold SQL text.
   - Delegates to `SAIF.BOF.Framework`: constructs `New clsSQLDataPortal(m_Env, True)` or `New clsMSOracleDataPortal(m_Env)`, then calls `DAL.AddDataPortal(portal, portal.PortalID & inKey)` on the framework's `clsDataAccess`/`IDataAccess` object.

   > **Origin**: Portal construction (`clsSQLDataPortal`/`clsMSOracleDataPortal`) and `AddDataPortal` registration are implemented in `SAIF.BOF.Framework`. The framework's own portal-construction operation sequence was not resolved via RAG for this run and is not traced further here.**
3. The returned `IDataPortalInfo` is stored in the internal `m_DPILibrary` (`SortedList(Of String, IDataPortalInfo)`), keyed by `inKey.ToLower`, and is later retrievable via the `DPI(inKey)` property.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Concrete subclass sets connection properties]) --> S1[Set DBUser, Database, Server, BatchID]
	S1 --> S2[Call CreateSQLServerPortal or CreateOraclePortal]
	S2 --> D{DBMS type?}
	D -->|SQL Server| S3[Construct clsSQLDataPortal]
	D -->|Oracle| S4[Construct clsMSOracleDataPortal]
	S3 --> S5[DAL.AddDataPortal]
	S4 --> S5
	S5 --> S6[Store IDataPortalInfo in m_DPILibrary keyed by inKey]
	S6 --> EndOk([Portal retrievable via DPI key])
```

## Failure and edge-case behavior
- The framework's own `AddDataPortal` operation sequence was not resolved via RAG for this run and is not traced further here.**

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [API reference](../api/index.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts. Statements marked with `**` could not be confirmed; treat
> as unknown until verified.

## Sources
- `SAIF.Application\ApplicationDataAccess.vb`
